<?php

namespace IDock\Insurance\DBIC\Request;

use IDock\Insurance\DBIC\Response\EPolicyDownloadResponse;
use IDock\Visitor\EPolicyDownloadVisitor;

class EPolicyDownloadRequest extends AllDBICRequest
{
    protected $route = 'dbic/pls/elePolicy/downLoad';

    protected $response = EPolicyDownloadResponse::class;

    protected $urlTip = '电子保单预览和下载接口';

    /**
     * @var  EPolicyDownloadVisitor $visitor
     */
    protected $visitor;

    public function generate(): array
    {
        $policy = $this->visitor->policyNo;

        return [
            'businessNo' => $policy,
            'businessType' => 'P',
            'riskCode' => substr($policy,1,4)
        ];
    }
}